/**
 * 
 */
package us.gaaoc.framework.webapp.backingbeans.admin;

import java.util.List;
import java.util.Map;

import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

import org.apache.log4j.Logger;

import us.gaaoc.framework.businessmodel.Filing;
import us.gaaoc.framework.dao.ModelFacade;
import us.gaaoc.framework.dao.ModelFacadeHibernate; 
import us.gaaoc.framework.model.CaseRecord;
import us.gaaoc.framework.model.CaseRecordWithFilerName;
import us.gaaoc.framework.webapp.backingbeans.BaseBackingBean;

/**
 * 
 * @author tapshals
 * @date May 24, 2006
 * @version: GAJE 1.5
 *
 */
public class ReceivedFilingPage extends BaseBackingBean {
	
	/**
	 * Properties
	 */
	private DataModel newFilingDataTable ; 
		
	private Logger LOG = Logger.getLogger(NewFilingPage.class);

	/**
	 * Constructor
	 *
	 */
	public ReceivedFilingPage(){		
		//load data    -- status = received , caseType = childEnforcement
		List<Filing> newFilings = this.getModelFacade().findCaseFilingsByTypeAndStatus(1, 1, (String) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("courtUuid"));
		newFilingDataTable = new ListDataModel();
		newFilingDataTable.setWrappedData(newFilings);
	}
	
	/**
	 * Getter for property newFilingDataTable
	 * @return newFilingDataTable
	 */
	public DataModel getNewFilingDataTable() {
		return newFilingDataTable;
	}

	/**
	 * Setter for property newFilingDataTable
	 * @param newFilingDataTable
	 */
	public void setNewFilingDataTable(DataModel newFilingDataTable) {
		this.newFilingDataTable = newFilingDataTable;
	}
		
	/**
	 * This method navigates user to the Case Details Page
	 * @return String
	 */
	@SuppressWarnings("unchecked")
	public String gotoCaseDetailPage(){
		Map sessionMap = this.getFacesContext().getExternalContext().getSessionMap();
	 	Map requestMap = this.getFacesContext().getExternalContext().getRequestParameterMap();
	 	String caseUuid = ((String) requestMap.get("caseUuid"));
	 	sessionMap.put("caseUuid", caseUuid);
	 	sessionMap.put("from", "ReceivedFilingPage");
	 	return "gotoCSECaseDetailsPage";
	}

	/**
	 * This method navigates user to the Child Enforcement Case Type Page
	 * @return String
	 */
	public String gotoChildEnforcementCaseTypePage() {
		return "gotoChildEnforcementCaseTypePage";
	}
		
	/**
	 * This method navigates user to the Case Record History Page
	 * @return String
	 */
	public String gotoHistoryPage() {
		Map sessionMap = this.getFacesContext().getExternalContext()
				.getSessionMap();
		Map requestMap = this.getFacesContext().getExternalContext()
				.getRequestParameterMap();
		String caseUuid = ((String) requestMap.get("caseUuid"));
		sessionMap.put("caseUuid", caseUuid);
		sessionMap.put("from", "ReceivedFilingPage");
		return "gotoCaseHistoryPage";
	}
}

